import os, os.path;

def list_prefix(in_list, what) :
	return [what + x for x in in_list];

def list_suffix(in_list, what) :
	return [x + what for x in in_list];

# directories
exe_name = 'bs_client';
tar_name = 'client';

# import custom settings
Import('*');

# construct base environ
base_env = custom_env.Clone();
base_env.AppendUnique(
	CPPDEFINES = ['BS_EXPORTING_PLUGIN'],
	CPPPATH = ['src', '#kernel/include', '#plugins/bs_cube/src'],
	LIBS = ['pthread']
);
#boost_libs = list_suffix(list_prefix(['system', 'filesystem', 'regex', 'thread', 'signals', 'python'], 'boost_'), '-mt');
#boost_libs_dbg = list_suffix(boost_libs, '-d');

# construct debug and release env
if build_kind == 'debug' :
	base_env.AppendUnique(LIBS = ['blue_sky_d', 'bs_cube_d', kernel_boost_libs_dbg]);
	exe_name += '_d';
else :
	base_env.AppendUnique(LIBS = ['blue_sky', 'bs_cube', kernel_boost_libs]);

# are we building with python support
if base_env['py'] == '1' :
	base_env.AppendUnique(
		CPPPATH = ['#kernel/include/python'],
		LIBS = ['${python_name}']
	);

# build target
client = base_env.Program(target = os.path.join(tar_exe_dir, exe_name), source = Glob(os.path.join('src', '*.cpp'), True, True));
# enable or disable dependencies
if base_env['deps'] == 'off' :
	Ignore(client, bs_kernel);
	Ignore(client, bs_cube);
elif base_env['deps'] == 'explicit' :
	Depends(client, bs_kernel);
	Depends(client, bs_cube);
# make alias
base_env.Alias(tar_name, client);

# Install step
if base_env['install'] == '1':
	inst_tar = base_env.Install('$prefix', client);
	Alias(tar_name, inst_tar);

